home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume21 / p2c / part01 next >
Encoding:
Internet Message Format  |  1990-04-05  |  61.3 KB

  1. Subject:  v21i046:  Pascal to C translator, Part01/32
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4. X-Checksum-Snefru: c25ae944 79ecd7e6 3bf506e0 0d07036e
  5.  
  6. Submitted-by: Dave Gillespie <daveg@csvax.caltech.edu>
  7. Posting-number: Volume 21, Issue 46
  8. Archive-name: p2c/part01
  9.  
  10. This is p2c a Pascal to C translator.  This is the second one in
  11. comp.sources.unix; the first one ptoc, appeared in volume 10.
  12.  
  13. P2c understands several Pascal dialects (HP, partial Turbo, etc) and
  14. is very flexible and configurable.
  15.  
  16. P2c was originally developed on a homebrew C compiler on the HP Pascal
  17. Workstation operating system.  Current development takes place on HP-UX,
  18. which is System V based.  The translator has also been compiled and used
  19. on Sun-3's, so presumably it is fairly portable among 32-bit Unix machines.
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of archive 1 (of 32)."
  28. # Contents:  HP/import/asm.imp HP/import/general_0.imp
  29. #   HP/import/general_1.imp HP/import/general_2.imp
  30. #   HP/import/general_3.imp HP/import/general_4.imp
  31. #   HP/import/hpib_0.imp HP/import/hpib_1.imp HP/import/hpib_2.imp
  32. #   HP/import/hpib_3.imp HP/import/misc.imp HP/import/rnd.imp
  33. #   HP/include/asm.h HP/include/general_0.h HP/include/general_1.h
  34. #   HP/include/general_2.h HP/include/general_3.h
  35. #   HP/include/general_4.h HP/include/hpib_0.h HP/include/hpib_1.h
  36. #   HP/include/hpib_2.h HP/include/hpib_3.h HP/include/rnd.h MANIFEST
  37. #   Makefile PACKNOTES README examples/Makefile examples/README
  38. #   examples/e.p examples/fact.p examples/p2crc examples/self.p
  39. #   src/loc.p2clib.c src/loc.p2crc src/string.pas src/system.m2
  40. # Wrapped by rsalz@litchi.bbn.com on Mon Mar 26 14:29:24 1990
  41. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  42. if test -f 'HP/import/asm.imp' -a "${1}" != "-c" ; then 
  43.   echo shar: Will not clobber existing file \"'HP/import/asm.imp'\"
  44. else
  45. echo shar: Extracting \"'HP/import/asm.imp'\" \(1332 characters\)
  46. sed "s/^X//" >'HP/import/asm.imp' <<'END_OF_FILE'
  47. X
  48. X
  49. X{IncludeFrom=asm <p2c/asm.h>}
  50. X
  51. X
  52. X{*VarStrings=1} {*ExportSymbol=asm_%s}
  53. X
  54. X
  55. Xmodule asm;
  56. Ximport sysglobals;
  57. Xexport
  58. Xtype
  59. Xstringmax = string[255];
  60. X procedure moveleft (anyvar s,d: integer; z:integer);
  61. X procedure moveright(anyvar s,d: integer; z:integer);
  62. X procedure fastmove (       s,d: anyptr;  z:integer);
  63. X procedure newbytes(var p: anyptr;        z:integer);
  64. X procedure powerup;
  65. X procedure errmsg;
  66. X procedure findroms;
  67. X procedure f_pwr_on;
  68. X procedure flpyread(sector: integer;  anyvar buffer: integer);
  69. X procedure flpy_wrt(sector: integer;  anyvar buffer: integer);
  70. X procedure flpymread(sector_count, sector: integer;  anyvar buffer: integer);
  71. X procedure flpymwrite(sector_count, sector: integer;  anyvar buffer: integer);
  72. X procedure flpyinit(ptr: anyptr; i: shortint);
  73. X procedure setintlevel(level: integer);
  74. X function  intlevel:  integer;
  75. X procedure newwords(var p: anyptr; wordsize: integer);
  76. X procedure userprogram (execloc,initsp: integer);
  77. X procedure sappend(var dest: string;src:stringmax);
  78. X function iand(a,b: integer): integer;
  79. X function ior (a,b: integer): integer;
  80. X procedure ci_switch;
  81. X procedure initvects;
  82. X procedure cpymsg(msg: string255);
  83. X function memavail:integer;
  84. X function ticker:integer;
  85. X procedure cache_on;
  86. X procedure cache_off;
  87. X procedure icache_off;
  88. X procedure icache_on;
  89. X procedure flush_icache;
  90. X
  91. X
  92. Xend.
  93. X
  94. X
  95. X
  96. END_OF_FILE
  97. if test 1332 -ne `wc -c <'HP/import/asm.imp'`; then
  98.     echo shar: \"'HP/import/asm.imp'\" unpacked with wrong size!
  99. fi
  100. # end of 'HP/import/asm.imp'
  101. fi
  102. if test -f 'HP/import/general_0.imp' -a "${1}" != "-c" ; then 
  103.   echo shar: Will not clobber existing file \"'HP/import/general_0.imp'\"
  104. else
  105. echo shar: Extracting \"'HP/import/general_0.imp'\" \(940 characters\)
  106. sed "s/^X//" >'HP/import/general_0.imp' <<'END_OF_FILE'
  107. X
  108. X
  109. X{IncludeFrom=general_0 <p2c/general_0.h>}
  110. X
  111. X
  112. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  113. X
  114. X
  115. XMODULE GENERAL_0;
  116. XIMPORT  iodeclarations; 
  117. X
  118. XEXPORT
  119. X
  120. X   VAR
  121. X      kbd_crt_drivers : drv_table_type;
  122. X      dummy_drivers   : drv_table_type;
  123. X
  124. X   FUNCTION  ioread_word ( select_code: type_isc ; register   : io_word ): io_word ;
  125. X   PROCEDURE iowrite_word( select_code: type_isc ; register   : io_word ;
  126. X                           value      : io_word);
  127. X   FUNCTION  ioread_byte ( select_code: type_isc ; register   : io_word ): io_byte ;
  128. X   PROCEDURE iowrite_byte( select_code: type_isc ; register   : io_word ;
  129. X                           value      : io_byte);
  130. X   FUNCTION  iostatus    ( select_code: type_isc ; register   : io_word ): io_word ;
  131. X   PROCEDURE iocontrol   ( select_code: type_isc ; register   : io_word ;
  132. X                           value      : io_word);
  133. X   PROCEDURE kernel_initialize;
  134. X   PROCEDURE io_system_reset;
  135. Xend.
  136. X
  137. END_OF_FILE
  138. if test 940 -ne `wc -c <'HP/import/general_0.imp'`; then
  139.     echo shar: \"'HP/import/general_0.imp'\" unpacked with wrong size!
  140. fi
  141. # end of 'HP/import/general_0.imp'
  142. fi
  143. if test -f 'HP/import/general_1.imp' -a "${1}" != "-c" ; then 
  144.   echo shar: Will not clobber existing file \"'HP/import/general_1.imp'\"
  145. else
  146. echo shar: Extracting \"'HP/import/general_1.imp'\" \(646 characters\)
  147. sed "s/^X//" >'HP/import/general_1.imp' <<'END_OF_FILE'
  148. X
  149. X
  150. X{IncludeFrom=general_1 <p2c/general_1.h>}
  151. X
  152. X
  153. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  154. X
  155. X
  156. XMODULE GENERAL_1;
  157. X
  158. XIMPORT
  159. X   iodeclarations;
  160. X
  161. XEXPORT
  162. X
  163. X   PROCEDURE ioinitialize;
  164. X   PROCEDURE iouninitialize;
  165. X   PROCEDURE ioreset     ( select_code : type_isc);
  166. X   PROCEDURE readchar    ( select_code : type_isc ; VAR value   : CHAR );
  167. X   PROCEDURE writechar   ( select_code : type_isc ; value       : CHAR );
  168. X   PROCEDURE readword    ( select_code : type_isc ; VAR num     : INTEGER);
  169. X   PROCEDURE writeword   ( select_code : type_isc ; value       : INTEGER);
  170. X   PROCEDURE set_timeout ( select_code : type_isc ; time        : REAL);
  171. XEND.
  172. X
  173. END_OF_FILE
  174. if test 646 -ne `wc -c <'HP/import/general_1.imp'`; then
  175.     echo shar: \"'HP/import/general_1.imp'\" unpacked with wrong size!
  176. fi
  177. # end of 'HP/import/general_1.imp'
  178. fi
  179. if test -f 'HP/import/general_2.imp' -a "${1}" != "-c" ; then 
  180.   echo shar: Will not clobber existing file \"'HP/import/general_2.imp'\"
  181. else
  182. echo shar: Extracting \"'HP/import/general_2.imp'\" \(911 characters\)
  183. sed "s/^X//" >'HP/import/general_2.imp' <<'END_OF_FILE'
  184. X
  185. X
  186. X{IncludeFrom=general_2 <p2c/general_2.h>}
  187. X
  188. X
  189. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  190. X
  191. X
  192. XMODULE GENERAL_2;
  193. XIMPORT    iodeclarations;  
  194. X
  195. XEXPORT
  196. X
  197. X   PROCEDURE readnumber ( device : type_device ; VAR num: REAL ) ;
  198. X   PROCEDURE writenumber ( device : type_device ; value  : REAL ) ;
  199. X   PROCEDURE readstring ( device : type_device ; VAR str: STRING ) ;
  200. X   PROCEDURE readstring_until ( term   : CHAR ; device : type_device ;
  201. X                                VAR str: STRING );
  202. X   PROCEDURE writestring ( device : type_device ; str    : io_STRING ) ;
  203. X   PROCEDURE readnumberln ( device : type_device ; VAR num: REAL );
  204. X   PROCEDURE writenumberln ( device : type_device ; value  : REAL );
  205. X   PROCEDURE writestringln ( device : type_device ; str    : io_STRING );
  206. X   PROCEDURE readuntil  ( term   : CHAR ; device : type_device );
  207. X   PROCEDURE skipfor    ( count  : INTEGER ; device : type_device );
  208. XEND.
  209. X
  210. END_OF_FILE
  211. if test 911 -ne `wc -c <'HP/import/general_2.imp'`; then
  212.     echo shar: \"'HP/import/general_2.imp'\" unpacked with wrong size!
  213. fi
  214. # end of 'HP/import/general_2.imp'
  215. fi
  216. if test -f 'HP/import/general_3.imp' -a "${1}" != "-c" ; then 
  217.   echo shar: Will not clobber existing file \"'HP/import/general_3.imp'\"
  218. else
  219. echo shar: Extracting \"'HP/import/general_3.imp'\" \(232 characters\)
  220. sed "s/^X//" >'HP/import/general_3.imp' <<'END_OF_FILE'
  221. X
  222. X
  223. X{IncludeFrom=general_3 <p2c/general_3.h>}
  224. X
  225. X
  226. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  227. X
  228. X
  229. XMODULE GENERAL_3;
  230. XIMPORT    iodeclarations ;  
  231. X
  232. XEXPORT
  233. X
  234. X   FUNCTION  ioerror_message ( ioerror : INTEGER )  : io_STRING;
  235. XEND.
  236. X
  237. END_OF_FILE
  238. if test 232 -ne `wc -c <'HP/import/general_3.imp'`; then
  239.     echo shar: \"'HP/import/general_3.imp'\" unpacked with wrong size!
  240. fi
  241. # end of 'HP/import/general_3.imp'
  242. fi
  243. if test -f 'HP/import/general_4.imp' -a "${1}" != "-c" ; then 
  244.   echo shar: Will not clobber existing file \"'HP/import/general_4.imp'\"
  245. else
  246. echo shar: Extracting \"'HP/import/general_4.imp'\" \(1992 characters\)
  247. sed "s/^X//" >'HP/import/general_4.imp' <<'END_OF_FILE'
  248. X
  249. X
  250. X{IncludeFrom=general_4 <p2c/general_4.h>}
  251. X
  252. X
  253. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  254. X
  255. X
  256. Xmodule general_4;
  257. Ximport    iodeclarations ;
  258. X
  259. Xexport
  260. X
  261. X   procedure abort_transfer ( var b_info: buf_info_type );
  262. X   function  transfer_setup ( device    : type_device; t_tfr     : user_tfr_type;
  263. X                              t_dir     : dir_of_tfr ; var b_info: buf_info_type ;
  264. X                              t_cnt : integer ): type_isc ;
  265. X   procedure transfer   ( device    : type_device; t_tfr     : user_tfr_type;
  266. X                          t_dir     : dir_of_tfr ; var b_info: buf_info_type;
  267. X                          x_count   : integer ) ;
  268. X   procedure transfer_word ( device    : type_device; t_tfr     : user_tfr_type;
  269. X                             t_dir     : dir_of_tfr ; var b_info: buf_info_type;
  270. X                             x_count   : integer ) ;
  271. X   procedure transfer_until ( term      : char ; device    : type_device;
  272. X                              t_tfr     : user_tfr_type; t_dir     : dir_of_tfr;
  273. X                              var b_info: buf_info_type ) ;
  274. X   procedure transfer_end ( device    : type_device; t_tfr     : user_tfr_type;
  275. X                            t_dir     : dir_of_tfr; var b_info: buf_info_type ) ;
  276. X   procedure iobuffer   ( var b_info: buf_info_type ; t_count   : integer );
  277. X   procedure buffer_reset(var b_info: buf_info_type ) ;
  278. X   function  buffer_space( var b_info: buf_info_type): integer;
  279. X   function  buffer_data( var b_info: buf_info_type): integer;
  280. X   procedure readbuffer ( var b_info: buf_info_type; var value : char);
  281. X   procedure writebuffer( var b_info: buf_info_type; value     : char);
  282. X   procedure readbuffer_string( var b_info: buf_info_type; var str   : string;
  283. X                                str_count : integer);
  284. X   procedure writebuffer_string ( var b_info: buf_info_type; str       : io_string);
  285. X   function  buffer_busy( var b_info: buf_info_type ): boolean;
  286. X   function  isc_busy   ( isc       : type_isc ): boolean;
  287. Xend.
  288. X
  289. END_OF_FILE
  290. if test 1992 -ne `wc -c <'HP/import/general_4.imp'`; then
  291.     echo shar: \"'HP/import/general_4.imp'\" unpacked with wrong size!
  292. fi
  293. # end of 'HP/import/general_4.imp'
  294. fi
  295. if test -f 'HP/import/hpib_0.imp' -a "${1}" != "-c" ; then 
  296.   echo shar: Will not clobber existing file \"'HP/import/hpib_0.imp'\"
  297. else
  298. echo shar: Extracting \"'HP/import/hpib_0.imp'\" \(775 characters\)
  299. sed "s/^X//" >'HP/import/hpib_0.imp' <<'END_OF_FILE'
  300. X
  301. X
  302. X{IncludeFrom=hpib_0 <p2c/hpib_0.h>}
  303. X
  304. X
  305. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  306. X
  307. X
  308. XMODULE hpib_0 ;        
  309. X
  310. X        { by      Tim Mikkelsen
  311. X          date    07/17/81
  312. X          update  09/17/81
  313. X          
  314. X          purpose This module contains the LEVEL 0 HPIB GROUP procedures.   
  315. X                
  316. X        }
  317. X
  318. X
  319. XIMPORT    iodeclarations ;  
  320. X        
  321. X        
  322. XEXPORT
  323. X  
  324. X        
  325. X  PROCEDURE set_hpib    ( select_code : type_isc ;
  326. X                          line        : type_hpib_line);
  327. X  PROCEDURE clear_hpib  ( select_code : type_isc ;
  328. X                          line        : type_hpib_line);
  329. X  FUNCTION  hpib_line   ( select_code : type_isc ;
  330. X                          line        : type_hpib_line)
  331. X                        : BOOLEAN;
  332. X
  333. XEND.    { of hpib_0 }
  334. X
  335. END_OF_FILE
  336. if test 775 -ne `wc -c <'HP/import/hpib_0.imp'`; then
  337.     echo shar: \"'HP/import/hpib_0.imp'\" unpacked with wrong size!
  338. fi
  339. # end of 'HP/import/hpib_0.imp'
  340. fi
  341. if test -f 'HP/import/hpib_1.imp' -a "${1}" != "-c" ; then 
  342.   echo shar: Will not clobber existing file \"'HP/import/hpib_1.imp'\"
  343. else
  344. echo shar: Extracting \"'HP/import/hpib_1.imp'\" \(1359 characters\)
  345. sed "s/^X//" >'HP/import/hpib_1.imp' <<'END_OF_FILE'
  346. X
  347. X
  348. X{IncludeFrom=hpib_1 <p2c/hpib_1.h>}
  349. X
  350. X
  351. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  352. X
  353. X
  354. XMODULE hpib_1 ;        
  355. X
  356. X        { by      Tim Mikkelsen
  357. X          date    07/16/81
  358. X          update  08/03/83 by J Schmidt
  359. X          
  360. X          purpose This module contains the LEVEL 1 HPIB GROUP procedures.   
  361. X                
  362. X        }
  363. X
  364. X
  365. XIMPORT    iodeclarations ;  
  366. X  
  367. XEXPORT
  368. X  
  369. X                          
  370. X  PROCEDURE send_command( select_code : type_isc ;
  371. X                          command     : CHAR );
  372. X  FUNCTION  my_address  ( select_code : type_isc)
  373. X                        : type_hpib_addr ;
  374. X  FUNCTION  active_controller
  375. X                        ( select_code : type_isc)
  376. X                        : BOOLEAN;
  377. X  FUNCTION  system_controller
  378. X                        ( select_code : type_isc)
  379. X                        : BOOLEAN;
  380. X  FUNCTION  addr_to_talk( device      : type_device)
  381. X                        : type_isc;
  382. X  FUNCTION  addr_to_listen
  383. X                        ( device      : type_device)
  384. X                        : type_isc;
  385. X  FUNCTION  set_to_talk ( device      : type_device)
  386. X                        : type_isc;
  387. X  FUNCTION  set_to_listen 
  388. X                        ( device      : type_device)
  389. X                        : type_isc;
  390. X  FUNCTION  end_set     ( select_code : type_isc )
  391. X                        : BOOLEAN;
  392. X  
  393. X  
  394. X  
  395. XEND.    { of hpib_1 }
  396. X
  397. END_OF_FILE
  398. if test 1359 -ne `wc -c <'HP/import/hpib_1.imp'`; then
  399.     echo shar: \"'HP/import/hpib_1.imp'\" unpacked with wrong size!
  400. fi
  401. # end of 'HP/import/hpib_1.imp'
  402. fi
  403. if test -f 'HP/import/hpib_2.imp' -a "${1}" != "-c" ; then 
  404.   echo shar: Will not clobber existing file \"'HP/import/hpib_2.imp'\"
  405. else
  406. echo shar: Extracting \"'HP/import/hpib_2.imp'\" \(1489 characters\)
  407. sed "s/^X//" >'HP/import/hpib_2.imp' <<'END_OF_FILE'
  408. X
  409. X
  410. X{IncludeFrom=hpib_2 <p2c/hpib_2.h>}
  411. X
  412. X
  413. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  414. X
  415. X
  416. XMODULE hpib_2 ;        
  417. X
  418. X        { by      Tim Mikkelsen
  419. X          date    07/17/81
  420. X          update  03/09/83
  421. X          
  422. X          purpose This module contains the LEVEL 
  423. X                  2 HPIB GROUP procedures.   
  424. X                
  425. X        }
  426. X
  427. X
  428. XIMPORT  iodeclarations ;  
  429. X  
  430. XEXPORT
  431. X  
  432. X                          
  433. X  PROCEDURE abort_hpib
  434. X                    ( select_code : type_isc);
  435. X  PROCEDURE clear   ( device      : type_device);
  436. X  PROCEDURE listen  ( select_code : type_isc ;   
  437. X                      address     : type_hpib_addr );
  438. X  PROCEDURE local   ( device      : type_device);
  439. X  PROCEDURE local_lockout
  440. X                    ( select_code : type_isc);
  441. X  PROCEDURE pass_control
  442. X                    ( device      : type_device);
  443. X  PROCEDURE ppoll_configure
  444. X                    ( device      : type_device;
  445. X                      mask        : INTEGER );
  446. X  PROCEDURE ppoll_unconfigure
  447. X                    ( device      : type_device);
  448. X  PROCEDURE remote  ( device      : type_device);
  449. X  PROCEDURE secondary
  450. X                    ( select_code : type_isc ;
  451. X                      address     : type_hpib_addr );
  452. X  PROCEDURE talk    ( select_code : type_isc ;
  453. X                      address     : type_hpib_addr );
  454. X  PROCEDURE trigger ( device      : type_device);
  455. X  PROCEDURE unlisten( select_code : type_isc );
  456. X  PROCEDURE untalk  ( select_code : type_isc );
  457. X  
  458. X  
  459. X
  460. XEND.    { of hpib_2 }
  461. X
  462. END_OF_FILE
  463. if test 1489 -ne `wc -c <'HP/import/hpib_2.imp'`; then
  464.     echo shar: \"'HP/import/hpib_2.imp'\" unpacked with wrong size!
  465. fi
  466. # end of 'HP/import/hpib_2.imp'
  467. fi
  468. if test -f 'HP/import/hpib_3.imp' -a "${1}" != "-c" ; then 
  469.   echo shar: Will not clobber existing file \"'HP/import/hpib_3.imp'\"
  470. else
  471. echo shar: Extracting \"'HP/import/hpib_3.imp'\" \(1178 characters\)
  472. sed "s/^X//" >'HP/import/hpib_3.imp' <<'END_OF_FILE'
  473. X
  474. X
  475. X{IncludeFrom=hpib_3 <p2c/hpib_3.h>}
  476. X
  477. X
  478. X{*VarStrings=0} {*ExportSymbol=P_%s} {*Export_Symbol=%s}
  479. X
  480. X
  481. XMODULE hpib_3 ;        
  482. X
  483. X        { by      Tim Mikkelsen
  484. X          date    07/17/81
  485. X          update  01/08/82
  486. X          
  487. X          purpose This module contains the LEVEL 
  488. X                  3 HPIB GROUP procedures.   
  489. X                
  490. X        }
  491. X
  492. X
  493. XIMPORT    iodeclarations ;  
  494. X  
  495. XEXPORT
  496. X  
  497. X                          
  498. X  FUNCTION  requested
  499. X                    ( select_code : type_isc )
  500. X                    : BOOLEAN ;
  501. X  FUNCTION  ppoll   ( select_code : type_isc )
  502. X                    : INTEGER ;
  503. X  FUNCTION  spoll   ( device      : type_device)
  504. X                    : INTEGER ;   
  505. X  
  506. X  PROCEDURE request_service 
  507. X                    ( select_code : type_isc ;
  508. X                      response    : INTEGER );
  509. X  FUNCTION  listener( select_code : type_isc )
  510. X                    : BOOLEAN;
  511. X  FUNCTION  talker  ( select_code : type_isc )   
  512. X                    : BOOLEAN ;
  513. X  FUNCTION  remoted ( select_code : type_isc )
  514. X                    : BOOLEAN ;
  515. X  FUNCTION  locked_out
  516. X                    ( select_code : type_isc )
  517. X                    : BOOLEAN ;
  518. X  
  519. X  
  520. X  
  521. XEND.    { of hpib_3 }
  522. X
  523. END_OF_FILE
  524. if test 1178 -ne `wc -c <'HP/import/hpib_3.imp'`; then
  525.     echo shar: \"'HP/import/hpib_3.imp'\" unpacked with wrong size!
  526. fi
  527. # end of 'HP/import/hpib_3.imp'
  528. fi
  529. if test -f 'HP/import/misc.imp' -a "${1}" != "-c" ; then 
  530.   echo shar: Will not clobber existing file \"'HP/import/misc.imp'\"
  531. else
  532. echo shar: Extracting \"'HP/import/misc.imp'\" \(2478 characters\)
  533. sed "s/^X//" >'HP/import/misc.imp' <<'END_OF_FILE'
  534. X
  535. X
  536. X{IncludeFrom=misc <p2c/misc.h>}
  537. X
  538. X
  539. X{*VarStrings=0} {*ExportSymbol=misc_%s}
  540. X
  541. X
  542. Xmodule misc;    {homeless orphans}
  543. X
  544. Ximport sysglobals, asm; 
  545. X
  546. Xexport
  547. X
  548. Xconst
  549. X  
  550. X  null  = 0;    nullchar  = chr(0);
  551. X                homechar  = chr(1); 
  552. X  etx   = 3; 
  553. X  bell  = 7;    bellchar  = chr(7); 
  554. X  bs    = 8;    leftchar  = chr(8); 
  555. X  tab   = 9;    cteol     = chr(9); 
  556. X  lf    = 10;   downchar  = chr(10); 
  557. X  vt    = 11;   cteos     = chr(11); 
  558. X  ff    = 12;   clearscr  = chr(12); 
  559. X  cr    = 13;   eol       = chr(13); 
  560. X  dle   = 16;     
  561. X  esc   = 27;   escchar   = chr(27);
  562. X  fsp   = 28;   rightchar = chr(28);
  563. X  us    = 31;   upchar    = chr(31); 
  564. X  del   = 127;
  565. X  cntrl = 255; 
  566. X
  567. Xtype 
  568. X(* CATALOGUE INFORMATION, zero entry refers to the directory itself *)
  569. X  
  570. X  catentry = record
  571. X    cname:  tid;                {name of file or directory}
  572. X    ceft:   shortint;           {external file type (LIF)}
  573. X    ckind:  filekind;           {file kind}
  574. X    cpsize: integer;            {physical size of file 
  575. X                                        or of total data space on volume}
  576. X    clsize: integer;            {logical size of file 
  577. X                                        or unused space on medium}
  578. X    cstart: integer;            {starting location of file 
  579. X                                        or first possible data location}
  580. X    cblocksize: integer;        {size of a sector or block}
  581. X    ccreatedate, clastdate:  daterec;   {creation, last modified dates}
  582. X    ccreatetime, clasttime:  timerec;   {creation, last modified times}
  583. X    cextra1,                    {extension 
  584. X                                        or total possible number of files
  585. X                                        or requested number of files}
  586. X    cextra2:   integer;         {secondary discretionary field
  587. X                                        or start index of requested catalog}
  588. X    cinfo:  string[20];         {comment or miscellaneous information}
  589. X    
  590. X    end; 
  591. X    
  592. X    passentry = record
  593. X                 pbits: integer; 
  594. X                 pword: passtype; 
  595. X                 end; 
  596. X    
  597. Xvar
  598. X  idle: byte;              { idle character -- 3.0 bug jws 3/20/84 }
  599. X  
  600. Xprocedure getioerrmsg(var s :string; lastior : integer);
  601. Xprocedure printerror(errorcode, lastior: integer); 
  602. Xprocedure upc(var s: string); 
  603. Xfunction ueovbytes(unit: unitnum): integer;
  604. Xprocedure unblockeddam(anyvar f: fib; unum: unitnum; request: damrequesttype); 
  605. Xprocedure initfilekinds;
  606. Xprocedure lockup; 
  607. Xprocedure lockdown; 
  608. X  
  609. X
  610. Xend.
  611. X
  612. X
  613. X
  614. END_OF_FILE
  615. if test 2478 -ne `wc -c <'HP/import/misc.imp'`; then
  616.     echo shar: \"'HP/import/misc.imp'\" unpacked with wrong size!
  617. fi
  618. # end of 'HP/import/misc.imp'
  619. fi
  620. if test -f 'HP/import/rnd.imp' -a "${1}" != "-c" ; then 
  621.   echo shar: Will not clobber existing file \"'HP/import/rnd.imp'\"
  622. else
  623. echo shar: Extracting \"'HP/import/rnd.imp'\" \(210 characters\)
  624. sed "s/^X//" >'HP/import/rnd.imp' <<'END_OF_FILE'
  625. X
  626. X
  627. X{IncludeFrom=misc <p2c/rnd.h>}
  628. X
  629. X
  630. X{*ExportSymbol=P_%s}
  631. X
  632. X
  633. Xmodule rnd;
  634. X
  635. Ximport sysglobals; 
  636. X
  637. Xexport
  638. X
  639. X
  640. Xprocedure random(var seed : integer);
  641. Xfunction rand(var seed : integer; max : integer) : integer;
  642. X
  643. X
  644. Xend.
  645. X
  646. X  
  647. END_OF_FILE
  648. if test 210 -ne `wc -c <'HP/import/rnd.imp'`; then
  649.     echo shar: \"'HP/import/rnd.imp'\" unpacked with wrong size!
  650. fi
  651. # end of 'HP/import/rnd.imp'
  652. fi
  653. if test -f 'HP/include/asm.h' -a "${1}" != "-c" ; then 
  654.   echo shar: Will not clobber existing file \"'HP/include/asm.h'\"
  655. else
  656. echo shar: Extracting \"'HP/include/asm.h'\" \(1663 characters\)
  657. sed "s/^X//" >'HP/include/asm.h' <<'END_OF_FILE'
  658. X/* Header for module asm, generated by p2c */
  659. X#ifndef ASM_H
  660. X#define ASM_H
  661. X
  662. X
  663. X
  664. X#ifndef SYSGLOBALS_H
  665. X#include <p2c/sysglobals.h>
  666. X#endif
  667. X
  668. X
  669. X
  670. X#ifdef ASM_G
  671. X# define vextern
  672. X#else
  673. X# define vextern extern
  674. X#endif
  675. X
  676. X
  677. X
  678. Xextern Void asm_moveleft PP((long *s, long *d, long z));
  679. Xextern Void asm_moveright PP((long *s, long *d, long z));
  680. Xextern Void asm_fastmove PP((Anyptr *s, Anyptr *d, long z));
  681. Xextern Void asm_newbytes PP((Anyptr **p, long z));
  682. Xextern Void asm_powerup PV( );
  683. Xextern Void asm_errmsg PV( );
  684. Xextern Void asm_findroms PV( );
  685. Xextern Void asm_f_pwr_on PV( );
  686. Xextern Void asm_flpyread PP((long sector, long *buffer));
  687. Xextern Void asm_flpy_wrt PP((long sector, long *buffer));
  688. Xextern Void asm_flpymread PP((long sector_count, long sector, long *buffer));
  689. Xextern Void asm_flpymwrite PP((long sector_count, long sector, long *buffer));
  690. Xextern Void asm_flpyinit PP((Anyptr *ptr, int i));
  691. Xextern Void asm_setintlevel PP((long level));
  692. Xextern long asm_intlevel PV( );
  693. Xextern Void asm_newwords PP((Anyptr **p, long wordsize));
  694. Xextern Void asm_userprogram PP((long execloc, long initsp));
  695. Xextern Void asm_sappend PP((Char *dest, int MAX_dest, Char *src));
  696. Xextern long asm_iand PP((long a, long b));
  697. Xextern long asm_ior PP((long a, long b));
  698. Xextern Void asm_ci_switch PV( );
  699. Xextern Void asm_initvects PV( );
  700. Xextern Void asm_cpymsg PP((Char *msg));
  701. X#define asm_memavail()        10000000
  702. X/*  extern long asm_memavail PV( );  */
  703. Xextern long asm_ticker PV( );
  704. Xextern Void asm_cache_on PV( );
  705. Xextern Void asm_cache_off PV( );
  706. Xextern Void asm_icache_off PV( );
  707. Xextern Void asm_icache_on PV( );
  708. Xextern Void asm_flush_icache PV( );
  709. X
  710. X
  711. X
  712. X#undef vextern
  713. X
  714. X#endif /*ASM_H*/
  715. X
  716. X/* End. */
  717. X
  718. END_OF_FILE
  719. if test 1663 -ne `wc -c <'HP/include/asm.h'`; then
  720.     echo shar: \"'HP/include/asm.h'\" unpacked with wrong size!
  721. fi
  722. # end of 'HP/include/asm.h'
  723. fi
  724. if test -f 'HP/include/general_0.h' -a "${1}" != "-c" ; then 
  725.   echo shar: Will not clobber existing file \"'HP/include/general_0.h'\"
  726. else
  727. echo shar: Extracting \"'HP/include/general_0.h'\" \(824 characters\)
  728. sed "s/^X//" >'HP/include/general_0.h' <<'END_OF_FILE'
  729. X/* Header for module GENERAL_0, generated by p2c */
  730. X#ifndef GENERAL_0_H
  731. X#define GENERAL_0_H
  732. X
  733. X
  734. X
  735. X#ifndef IODECLARATIONS_H
  736. X#include <p2c/iodecl.h>
  737. X#endif
  738. X
  739. X
  740. X
  741. X#ifdef GENERAL_0_G
  742. X# define vextern
  743. X#else
  744. X# define vextern extern
  745. X#endif
  746. X
  747. X
  748. X
  749. Xvextern drv_table_type kbd_crt_drivers, dummy_drivers;
  750. X
  751. X
  752. X
  753. Xextern short ioread_word PP((int select_code, int register_));
  754. Xextern Void iowrite_word PP((int select_code, int register_, int value));
  755. Xextern uchar ioread_byte PP((int select_code, int register_));
  756. Xextern Void iowrite_byte PP((int select_code, int register_, int value));
  757. Xextern short P_iostatus PP((int select_code, int register_));
  758. Xextern Void P_iocontrol PP((int select_code, int register_, int value));
  759. Xextern Void kernel_initialize PV( );
  760. Xextern Void io_system_reset PV( );
  761. X
  762. X
  763. X
  764. X#undef vextern
  765. X
  766. X#endif /*GENERAL_0_H*/
  767. X
  768. X/* End. */
  769. X
  770. END_OF_FILE
  771. if test 824 -ne `wc -c <'HP/include/general_0.h'`; then
  772.     echo shar: \"'HP/include/general_0.h'\" unpacked with wrong size!
  773. fi
  774. # end of 'HP/include/general_0.h'
  775. fi
  776. if test -f 'HP/include/general_1.h' -a "${1}" != "-c" ; then 
  777.   echo shar: Will not clobber existing file \"'HP/include/general_1.h'\"
  778. else
  779. echo shar: Extracting \"'HP/include/general_1.h'\" \(690 characters\)
  780. sed "s/^X//" >'HP/include/general_1.h' <<'END_OF_FILE'
  781. X/* Header for module GENERAL_1, generated by p2c */
  782. X#ifndef GENERAL_1_H
  783. X#define GENERAL_1_H
  784. X
  785. X
  786. X
  787. X#ifndef IODECLARATIONS_H
  788. X#include <p2c/iodecl.h>
  789. X#endif
  790. X
  791. X
  792. X
  793. X#ifdef GENERAL_1_G
  794. X# define vextern
  795. X#else
  796. X# define vextern extern
  797. X#endif
  798. Xextern Void P_ioinitialize PV( );
  799. Xextern Void P_iouninitialize PV( );
  800. Xextern Void P_ioreset PP((int select_code));
  801. Xextern Void P_readchar PP((int select_code, Char *value));
  802. Xextern Void P_writechar PP((int select_code, int value));
  803. Xextern Void P_readword PP((int select_code, long *num));
  804. Xextern Void P_writeword PP((int select_code, long value));
  805. Xextern Void set_timeout PP((int select_code, double time));
  806. X
  807. X
  808. X
  809. X#undef vextern
  810. X
  811. X#endif /*GENERAL_1_H*/
  812. X
  813. X/* End. */
  814. X
  815. END_OF_FILE
  816. if test 690 -ne `wc -c <'HP/include/general_1.h'`; then
  817.     echo shar: \"'HP/include/general_1.h'\" unpacked with wrong size!
  818. fi
  819. # end of 'HP/include/general_1.h'
  820. fi
  821. if test -f 'HP/include/general_2.h' -a "${1}" != "-c" ; then 
  822.   echo shar: Will not clobber existing file \"'HP/include/general_2.h'\"
  823. else
  824. echo shar: Extracting \"'HP/include/general_2.h'\" \(862 characters\)
  825. sed "s/^X//" >'HP/include/general_2.h' <<'END_OF_FILE'
  826. X/* Header for module GENERAL_2, generated by p2c */
  827. X#ifndef GENERAL_2_H
  828. X#define GENERAL_2_H
  829. X
  830. X
  831. X
  832. X#ifndef IODECLARATIONS_H
  833. X#include <p2c/iodecl.h>
  834. X#endif
  835. X
  836. X
  837. X
  838. X#ifdef GENERAL_2_G
  839. X# define vextern
  840. X#else
  841. X# define vextern extern
  842. X#endif
  843. Xextern Void P_readnumber PP((long device, double *num));
  844. Xextern Void P_writenumber PP((long device, double value));
  845. Xextern Void P_readstring PP((long device, Char *str));
  846. Xextern Void readstring_until PP((int term, long device, Char *str));
  847. Xextern Void P_writestring PP((long device, Char *str));
  848. Xextern Void P_readnumberln PP((long device, double *num));
  849. Xextern Void P_writenumberln PP((long device, double value));
  850. Xextern Void P_writestringln PP((long device, Char *str));
  851. Xextern Void P_readuntil PP((int term, long device));
  852. Xextern Void P_skipfor PP((long count, long device));
  853. X
  854. X
  855. X
  856. X#undef vextern
  857. X
  858. X#endif /*GENERAL_2_H*/
  859. X
  860. X/* End. */
  861. X
  862. END_OF_FILE
  863. if test 862 -ne `wc -c <'HP/include/general_2.h'`; then
  864.     echo shar: \"'HP/include/general_2.h'\" unpacked with wrong size!
  865. fi
  866. # end of 'HP/include/general_2.h'
  867. fi
  868. if test -f 'HP/include/general_3.h' -a "${1}" != "-c" ; then 
  869.   echo shar: Will not clobber existing file \"'HP/include/general_3.h'\"
  870. else
  871. echo shar: Extracting \"'HP/include/general_3.h'\" \(347 characters\)
  872. sed "s/^X//" >'HP/include/general_3.h' <<'END_OF_FILE'
  873. X/* Header for module GENERAL_3, generated by p2c */
  874. X#ifndef GENERAL_3_H
  875. X#define GENERAL_3_H
  876. X
  877. X
  878. X
  879. X#ifndef IODECLARATIONS_H
  880. X#include <p2c/iodecl.h>
  881. X#endif
  882. X
  883. X
  884. X
  885. X#ifdef GENERAL_3_G
  886. X# define vextern
  887. X#else
  888. X# define vextern extern
  889. X#endif
  890. Xextern Char *ioerror_message PP((Char *P_Result, long ioerror));
  891. X
  892. X
  893. X
  894. X#undef vextern
  895. X
  896. X#endif /*GENERAL_3_H*/
  897. X
  898. X/* End. */
  899. X
  900. END_OF_FILE
  901. if test 347 -ne `wc -c <'HP/include/general_3.h'`; then
  902.     echo shar: \"'HP/include/general_3.h'\" unpacked with wrong size!
  903. fi
  904. # end of 'HP/include/general_3.h'
  905. fi
  906. if test -f 'HP/include/general_4.h' -a "${1}" != "-c" ; then 
  907.   echo shar: Will not clobber existing file \"'HP/include/general_4.h'\"
  908. else
  909. echo shar: Extracting \"'HP/include/general_4.h'\" \(1497 characters\)
  910. sed "s/^X//" >'HP/include/general_4.h' <<'END_OF_FILE'
  911. X/* Header for module general_4, generated by p2c */
  912. X#ifndef GENERAL_4_H
  913. X#define GENERAL_4_H
  914. X
  915. X
  916. X
  917. X#ifndef IODECLARATIONS_H
  918. X#include <p2c/iodecl.h>
  919. X#endif
  920. X
  921. X
  922. X
  923. X#ifdef GENERAL_4_G
  924. X# define vextern
  925. X#else
  926. X# define vextern extern
  927. X#endif
  928. Xextern Void abort_transfer PP((buf_info_type *b_info));
  929. Xextern char transfer_setup PP((long device, int t_tfr, int t_dir,
  930. X                   buf_info_type *b_info, long t_cnt));
  931. Xextern Void P_transfer PP((long device, int t_tfr, int t_dir,
  932. X               buf_info_type *b_info, long x_count));
  933. Xextern Void transfer_word PP((long device, int t_tfr, int t_dir,
  934. X                  buf_info_type *b_info, long x_count));
  935. Xextern Void transfer_until PP((int term, long device, int t_tfr, int t_dir,
  936. X                   buf_info_type *b_info));
  937. Xextern Void transfer_end PP((long device, int t_tfr, int t_dir,
  938. X                 buf_info_type *b_info));
  939. Xextern Void P_iobuffer PP((buf_info_type *b_info, long t_count));
  940. Xextern Void buffer_reset PP((buf_info_type *b_info));
  941. Xextern long buffer_space PP((buf_info_type *b_info));
  942. Xextern long buffer_data PP((buf_info_type *b_info));
  943. Xextern Void P_readbuffer PP((buf_info_type *b_info, Char *value));
  944. Xextern Void P_writebuffer PP((buf_info_type *b_info, int value));
  945. Xextern Void readbuffer_string PP((buf_info_type *b_info, Char *str,
  946. X                  long str_count));
  947. Xextern Void writebuffer_string PP((buf_info_type *b_info, Char *str));
  948. Xextern boolean buffer_busy PP((buf_info_type *b_info));
  949. Xextern boolean isc_busy PP((int isc));
  950. X
  951. X
  952. X
  953. X#undef vextern
  954. X
  955. X#endif /*GENERAL_4_H*/
  956. X
  957. X/* End. */
  958. X
  959. END_OF_FILE
  960. if test 1497 -ne `wc -c <'HP/include/general_4.h'`; then
  961.     echo shar: \"'HP/include/general_4.h'\" unpacked with wrong size!
  962. fi
  963. # end of 'HP/include/general_4.h'
  964. fi
  965. if test -f 'HP/include/hpib_0.h' -a "${1}" != "-c" ; then 
  966.   echo shar: Will not clobber existing file \"'HP/include/hpib_0.h'\"
  967. else
  968. echo shar: Extracting \"'HP/include/hpib_0.h'\" \(435 characters\)
  969. sed "s/^X//" >'HP/include/hpib_0.h' <<'END_OF_FILE'
  970. X/* Header for module hpib_0, generated by p2c */
  971. X#ifndef HPIB_0_H
  972. X#define HPIB_0_H
  973. X
  974. X
  975. X
  976. X#ifndef IODECLARATIONS_H
  977. X#include <p2c/iodecl.h>
  978. X#endif
  979. X
  980. X
  981. X
  982. X#ifdef HPIB_0_G
  983. X# define vextern
  984. X#else
  985. X# define vextern extern
  986. X#endif
  987. Xextern Void set_hpib PP((int select_code, int line));
  988. Xextern Void clear_hpib PP((int select_code, int line));
  989. Xextern boolean hpib_line PP((int select_code, int line));
  990. X
  991. X
  992. X
  993. X#undef vextern
  994. X
  995. X#endif /*HPIB_0_H*/
  996. X
  997. X/* End. */
  998. X
  999. END_OF_FILE
  1000. if test 435 -ne `wc -c <'HP/include/hpib_0.h'`; then
  1001.     echo shar: \"'HP/include/hpib_0.h'\" unpacked with wrong size!
  1002. fi
  1003. # end of 'HP/include/hpib_0.h'
  1004. fi
  1005. if test -f 'HP/include/hpib_1.h' -a "${1}" != "-c" ; then 
  1006.   echo shar: Will not clobber existing file \"'HP/include/hpib_1.h'\"
  1007. else
  1008. echo shar: Extracting \"'HP/include/hpib_1.h'\" \(710 characters\)
  1009. sed "s/^X//" >'HP/include/hpib_1.h' <<'END_OF_FILE'
  1010. X/* Header for module hpib_1, generated by p2c */
  1011. X#ifndef HPIB_1_H
  1012. X#define HPIB_1_H
  1013. X
  1014. X
  1015. X
  1016. X#ifndef IODECLARATIONS_H
  1017. X#include <p2c/iodecl.h>
  1018. X#endif
  1019. X
  1020. X
  1021. X
  1022. X#ifdef HPIB_1_G
  1023. X# define vextern
  1024. X#else
  1025. X# define vextern extern
  1026. X#endif
  1027. Xextern Void send_command PP((int select_code, int command));
  1028. Xextern char my_address PP((int select_code));
  1029. Xextern boolean active_controller PP((int select_code));
  1030. Xextern boolean system_controller PP((int select_code));
  1031. Xextern char addr_to_talk PP((long device));
  1032. Xextern char addr_to_listen PP((long device));
  1033. Xextern char set_to_talk PP((long device));
  1034. Xextern char set_to_listen PP((long device));
  1035. Xextern boolean end_set PP((int select_code));
  1036. X
  1037. X
  1038. X
  1039. X#undef vextern
  1040. X
  1041. X#endif /*HPIB_1_H*/
  1042. X
  1043. X/* End. */
  1044. X
  1045. END_OF_FILE
  1046. if test 710 -ne `wc -c <'HP/include/hpib_1.h'`; then
  1047.     echo shar: \"'HP/include/hpib_1.h'\" unpacked with wrong size!
  1048. fi
  1049. # end of 'HP/include/hpib_1.h'
  1050. fi
  1051. if test -f 'HP/include/hpib_2.h' -a "${1}" != "-c" ; then 
  1052.   echo shar: Will not clobber existing file \"'HP/include/hpib_2.h'\"
  1053. else
  1054. echo shar: Extracting \"'HP/include/hpib_2.h'\" \(934 characters\)
  1055. sed "s/^X//" >'HP/include/hpib_2.h' <<'END_OF_FILE'
  1056. X/* Header for module hpib_2, generated by p2c */
  1057. X#ifndef HPIB_2_H
  1058. X#define HPIB_2_H
  1059. X
  1060. X
  1061. X
  1062. X#ifndef IODECLARATIONS_H
  1063. X#include <p2c/iodecl.h>
  1064. X#endif
  1065. X
  1066. X
  1067. X
  1068. X#ifdef HPIB_2_G
  1069. X# define vextern
  1070. X#else
  1071. X# define vextern extern
  1072. X#endif
  1073. Xextern Void abort_hpib PP((int select_code));
  1074. Xextern Void P_clear PP((long device));
  1075. Xextern Void P_listen PP((int select_code, int address));
  1076. Xextern Void P_local PP((long device));
  1077. Xextern Void local_lockout PP((int select_code));
  1078. Xextern Void pass_control PP((long device));
  1079. Xextern Void ppoll_configure PP((long device, long mask));
  1080. Xextern Void ppoll_unconfigure PP((long device));
  1081. Xextern Void P_remote PP((long device));
  1082. Xextern Void P_secondary PP((int select_code, int address));
  1083. Xextern Void P_talk PP((int select_code, int address));
  1084. Xextern Void P_trigger PP((long device));
  1085. Xextern Void P_unlisten PP((int select_code));
  1086. Xextern Void P_untalk PP((int select_code));
  1087. X
  1088. X
  1089. X
  1090. X#undef vextern
  1091. X
  1092. X#endif /*HPIB_2_H*/
  1093. X
  1094. X/* End. */
  1095. X
  1096. END_OF_FILE
  1097. if test 934 -ne `wc -c <'HP/include/hpib_2.h'`; then
  1098.     echo shar: \"'HP/include/hpib_2.h'\" unpacked with wrong size!
  1099. fi
  1100. # end of 'HP/include/hpib_2.h'
  1101. fi
  1102. if test -f 'HP/include/hpib_3.h' -a "${1}" != "-c" ; then 
  1103.   echo shar: Will not clobber existing file \"'HP/include/hpib_3.h'\"
  1104. else
  1105. echo shar: Extracting \"'HP/include/hpib_3.h'\" \(658 characters\)
  1106. sed "s/^X//" >'HP/include/hpib_3.h' <<'END_OF_FILE'
  1107. X/* Header for module hpib_3, generated by p2c */
  1108. X#ifndef HPIB_3_H
  1109. X#define HPIB_3_H
  1110. X
  1111. X
  1112. X
  1113. X#ifndef IODECLARATIONS_H
  1114. X#include <p2c/iodecl.h>
  1115. X#endif
  1116. X
  1117. X
  1118. X
  1119. X#ifdef HPIB_3_G
  1120. X# define vextern
  1121. X#else
  1122. X# define vextern extern
  1123. X#endif
  1124. Xextern boolean P_requested PP((int select_code));
  1125. Xextern long P_ppoll PP((int select_code));
  1126. Xextern long P_spoll PP((long device));
  1127. Xextern Void request_service PP((int select_code, long response));
  1128. Xextern boolean P_listener PP((int select_code));
  1129. Xextern boolean P_talker PP((int select_code));
  1130. Xextern boolean P_remoted PP((int select_code));
  1131. Xextern boolean locked_out PP((int select_code));
  1132. X
  1133. X
  1134. X
  1135. X#undef vextern
  1136. X
  1137. X#endif /*HPIB_3_H*/
  1138. X
  1139. X/* End. */
  1140. X
  1141. END_OF_FILE
  1142. if test 658 -ne `wc -c <'HP/include/hpib_3.h'`; then
  1143.     echo shar: \"'HP/include/hpib_3.h'\" unpacked with wrong size!
  1144. fi
  1145. # end of 'HP/include/hpib_3.h'
  1146. fi
  1147. if test -f 'HP/include/rnd.h' -a "${1}" != "-c" ; then 
  1148.   echo shar: Will not clobber existing file \"'HP/include/rnd.h'\"
  1149. else
  1150. echo shar: Extracting \"'HP/include/rnd.h'\" \(160 characters\)
  1151. sed "s/^X//" >'HP/include/rnd.h' <<'END_OF_FILE'
  1152. X#ifndef RND_H
  1153. X#define RND_H
  1154. X
  1155. X#ifdef RND_G
  1156. X# define vextern
  1157. X#else
  1158. X# define vextern extern
  1159. X#endif
  1160. X
  1161. X
  1162. Xextern void P_random();
  1163. Xextern long P_rand();
  1164. X
  1165. X
  1166. X
  1167. X#endif RND_H
  1168. END_OF_FILE
  1169. if test 160 -ne `wc -c <'HP/include/rnd.h'`; then
  1170.     echo shar: \"'HP/include/rnd.h'\" unpacked with wrong size!
  1171. fi
  1172. # end of 'HP/include/rnd.h'
  1173. fi
  1174. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  1175.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  1176. else
  1177. echo shar: Extracting \"'MANIFEST'\" \(3100 characters\)
  1178. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  1179. X   File Name        Archive #    Description
  1180. X-----------------------------------------------------------
  1181. X HP/import/asm.imp          1    
  1182. X HP/import/fs.imp           2    
  1183. X HP/import/general_0.imp    1    
  1184. X HP/import/general_1.imp    1    
  1185. X HP/import/general_2.imp    1    
  1186. X HP/import/general_3.imp    1    
  1187. X HP/import/general_4.imp    1    
  1188. X HP/import/hpib_0.imp       1    
  1189. X HP/import/hpib_1.imp       1    
  1190. X HP/import/hpib_2.imp       1    
  1191. X HP/import/hpib_3.imp       1    
  1192. X HP/import/iodecl.imp       4    
  1193. X HP/import/misc.imp         1    
  1194. X HP/import/rnd.imp          1    
  1195. X HP/import/sysdevs.imp      6    
  1196. X HP/import/sysglobals.imp   5    
  1197. X HP/include/asm.h           1    
  1198. X HP/include/fs.h            2    
  1199. X HP/include/general_0.h     1    
  1200. X HP/include/general_1.h     1    
  1201. X HP/include/general_2.h     1    
  1202. X HP/include/general_3.h     1    
  1203. X HP/include/general_4.h     1    
  1204. X HP/include/hpib_0.h        1    
  1205. X HP/include/hpib_1.h        1    
  1206. X HP/include/hpib_2.h        1    
  1207. X HP/include/hpib_3.h        1    
  1208. X HP/include/iodecl.h        2    
  1209. X HP/include/misc.h          2    
  1210. X HP/include/rnd.h           1    
  1211. X HP/include/sysdevs.h       4    
  1212. X HP/include/sysglobals.h    3    
  1213. X MANIFEST                   1    
  1214. X Makefile                   1    
  1215. X PACKNOTES                  1    Warnings about long lines, etc
  1216. X README                     1    
  1217. X examples/Makefile          1    
  1218. X examples/README            1    
  1219. X examples/basic.doc         4    
  1220. X examples/basic.p.1        19    (part 1)
  1221. X examples/basic.p.2         7    (part 2)
  1222. X examples/cref.p            4    
  1223. X examples/e.p               1    
  1224. X examples/fact.p            1    
  1225. X examples/p2crc             1    
  1226. X examples/self.p            1    
  1227. X src/COPYING                5    
  1228. X src/HISTORY                7    
  1229. X src/INSTALL                2    
  1230. X src/Makefile               2    
  1231. X src/NOTES                 11    
  1232. X src/README                 2    
  1233. X src/citmods.c             10    
  1234. X src/comment.c              3    
  1235. X src/decl.c.1              28    (part 1)
  1236. X src/decl.c.2              27    (part 2)
  1237. X src/decl.c.3              14    (part 3)
  1238. X src/dir.c                  2    
  1239. X src/expr.c.1              26    (part 1)
  1240. X src/expr.c.2              25    (part 2)
  1241. X src/expr.c.3              16    (part 3)
  1242. X src/funcs.c.1             21    (part 1)
  1243. X src/funcs.c.2             22    (part 2)
  1244. X src/funcs.c.3             17    (part 3)
  1245. X src/hpmods.c               2    
  1246. X src/lex.c.1               31    (part 1)
  1247. X src/lex.c.2               13    (part 2)
  1248. X src/loc.p2clib.c           1    
  1249. X src/loc.p2crc              1    
  1250. X src/makeproto.c            6    
  1251. X src/out.c                 12    
  1252. X src/p2c.h                  3    
  1253. X src/p2c.man               18    
  1254. X src/p2clib.c               6    
  1255. X src/parse.c.1             29    (part 1)
  1256. X src/parse.c.2             30    (part 2)
  1257. X src/parse.c.3              8    (part 3)
  1258. X src/pexpr.c.1             23    (part 1)
  1259. X src/pexpr.c.2             24    (part 2)
  1260. X src/pexpr.c.3              3    (part 3)
  1261. X src/string.pas             1    
  1262. X src/stuff.c                5    
  1263. X src/sys.p2crc.1           32    (part 1)
  1264. X src/sys.p2crc.2            8    (part 2)
  1265. X src/system.imp             2    
  1266. X src/system.m2              1    
  1267. X src/trans.c               15    
  1268. X src/trans.h.1             20    (part 1)
  1269. X src/trans.h.2              9    (part 2)
  1270. X src/turbo.imp              3    
  1271. END_OF_FILE
  1272. if test 3100 -ne `wc -c <'MANIFEST'`; then
  1273.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  1274. fi
  1275. # end of 'MANIFEST'
  1276. fi
  1277. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  1278.   echo shar: Will not clobber existing file \"'Makefile'\"
  1279. else
  1280. echo shar: Extracting \"'Makefile'\" \(1629 characters\)
  1281. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  1282. X# Makefile for "p2c", the Pascal to C translator.
  1283. X#  Copyright (C) 1989 David Gillespie.
  1284. X#  Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125.
  1285. X
  1286. X# This program is free software; you can redistribute it and/or modify
  1287. X# it under the terms of the GNU General Public License as published by
  1288. X# the Free Software Foundation (any version).
  1289. X
  1290. X# This program is distributed in the hope that it will be useful,
  1291. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1292. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1293. X# GNU General Public License for more details.
  1294. X
  1295. X# You should have received a copy of the GNU General Public License
  1296. X# along with this program; see the file COPYING.  If not, write to
  1297. X# the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1298. X
  1299. X
  1300. X
  1301. X# This file compiles and installs p2c in the "home" subdirectory of this
  1302. X# directory, then runs it on various example programs in the "examples"
  1303. X# subdirectory.  To install a permanent, public copy of p2c, see "README"
  1304. X# and src/Makefile.
  1305. X
  1306. Xtest:
  1307. X    @echo "Compiling p2c, installing in `pwd`/home..."
  1308. X    cd src; make install
  1309. X    @echo ""
  1310. X    @echo "Translating and compiling example files..."
  1311. X    cd examples; make comp
  1312. X    @echo ""
  1313. X    @echo "Running the factorial example..."
  1314. X    examples/fact
  1315. X    @echo ""
  1316. X    @echo "Running the 'e' computation example..."
  1317. X    examples/e
  1318. X    @echo ""
  1319. X    @echo "Running the self-printing Pascal example..."
  1320. X    examples/self >examples/self.out
  1321. X    cat examples/self.out
  1322. X    diff examples/self.p examples/self.out
  1323. X    @echo ""
  1324. X    @echo "Also try 'cref' and 'basic' in the examples directory."
  1325. X
  1326. X
  1327. Xinstall:
  1328. X    cd src; make install
  1329. X
  1330. END_OF_FILE
  1331. if test 1629 -ne `wc -c <'Makefile'`; then
  1332.     echo shar: \"'Makefile'\" unpacked with wrong size!
  1333. fi
  1334. # end of 'Makefile'
  1335. fi
  1336. if test -f 'PACKNOTES' -a "${1}" != "-c" ; then 
  1337.   echo shar: Will not clobber existing file \"'PACKNOTES'\"
  1338. else
  1339. echo shar: Extracting \"'PACKNOTES'\" \(900 characters\)
  1340. sed "s/^X//" >'PACKNOTES' <<'END_OF_FILE'
  1341. XFile "src/sys.p2crc" was split because of its size; to create it, do
  1342. X    cat src/sys.p2crc.? >src/sys.p2crc
  1343. XFile "src/lex.c" was split because of its size; to create it, do
  1344. X    cat src/lex.c.? >src/lex.c
  1345. XFile "src/parse.c" was split because of its size; to create it, do
  1346. X    cat src/parse.c.? >src/parse.c
  1347. XFile "src/decl.c" was split because of its size; to create it, do
  1348. X    cat src/decl.c.? >src/decl.c
  1349. XFile "src/expr.c" was split because of its size; to create it, do
  1350. X    cat src/expr.c.? >src/expr.c
  1351. XFile "src/pexpr.c" was split because of its size; to create it, do
  1352. X    cat src/pexpr.c.? >src/pexpr.c
  1353. XFile "src/funcs.c" was split because of its size; to create it, do
  1354. X    cat src/funcs.c.? >src/funcs.c
  1355. XFile "src/trans.h" was split because of its size; to create it, do
  1356. X    cat src/trans.h.? >src/trans.h
  1357. XFile "examples/basic.p" was split because of its size; to create it, do
  1358. X    cat examples/basic.p.? >examples/basic.p
  1359. END_OF_FILE
  1360. if test 900 -ne `wc -c <'PACKNOTES'`; then
  1361.     echo shar: \"'PACKNOTES'\" unpacked with wrong size!
  1362. fi
  1363. # end of 'PACKNOTES'
  1364. fi
  1365. if test -f 'README' -a "${1}" != "-c" ; then 
  1366.   echo shar: Will not clobber existing file \"'README'\"
  1367. else
  1368. echo shar: Extracting \"'README'\" \(5638 characters\)
  1369. sed "s/^X//" >'README' <<'END_OF_FILE'
  1370. X
  1371. XThis directory contains "p2c" version 1.14, a Pascal to C translator.
  1372. X
  1373. X"p2c"  Copyright 1989  Dave Gillespie
  1374. X                       256-80 Caltech
  1375. X                       Pasadena CA 91125
  1376. X                       daveg@csvax.caltech.edu, cit-vax!daveg
  1377. X
  1378. X
  1379. XThis program is distributed under the terms of the GNU License Agreement.
  1380. XSee the file src/COPYING for details.
  1381. X
  1382. XThe GNU License Agreement restrictions do _not_ apply to code generated
  1383. Xby p2c, nor to the p2c run-time files "p2clib.c" and "p2c.h".
  1384. X
  1385. X
  1386. X
  1387. XQUICK INSTRUCTIONS
  1388. X
  1389. XThe top-level Makefile in this directory tree knows how to build
  1390. Xp2c and run it on some example programs.  The compiled p2c will be
  1391. X"installed" in this directory tree rather than in public directories.
  1392. X(For a full public installation, see the instructions below.)
  1393. XJust type "make test" to build p2c and run the examples.
  1394. X
  1395. X
  1396. X
  1397. XFULL INSTALLATION INSTRUCTIONS
  1398. X
  1399. XFor a complete system, you must:
  1400. X
  1401. X   a) Create a home directory for p2c, such as /usr/lib/p2c.  The exact
  1402. X      location does not matter, as long as p2c knows how to find it.
  1403. X
  1404. X   b) Create an include directory, such as /usr/include/p2c.  If you are
  1405. X      unable to arrange for an include directory, you can edit sys.p2crc
  1406. X      so as not to require one, or compile translated code with a
  1407. X      suitable -I flag.
  1408. X
  1409. X   c) Install the executable "p2c" in /usr/bin or elsewhere on the
  1410. X      standard search path.
  1411. X
  1412. X   d) Install the run-time library "libp2c.a" in /usr/lib or elsewhere
  1413. X      on the standard library search path.
  1414. X
  1415. X   e) Install the Unix manual entry "p2c.1" in /usr/man/man1.  If you
  1416. X      have a "man1.Z" directory instead (for compressed man pages)
  1417. X      you will have to edit the Makefile to use a "compress" command.
  1418. X
  1419. X   f) Install the necessary files in the p2c home directory.
  1420. X
  1421. XThe Makefile is initially set up to create a private version of p2c in
  1422. Xthe p2c distribution directory.  Just "cd src" and "make install" to
  1423. Xperform the above steps.  This will place the p2c executable, run-time
  1424. Xlibrary, include directory, and man page in the "home" subdirectory of
  1425. Xthe distribution directory.  The man page will be in human-readable form.
  1426. X
  1427. XTo compile code that has been translated by this private version of p2c,
  1428. Xuse the command:
  1429. X
  1430. X    cc -I. foo.c libp2c.a
  1431. X
  1432. X(assuming "home," i.e., HOMEDIR, is the current directory.)
  1433. X
  1434. XThe "examples" subdirectory contains a few sample Pascal programs and
  1435. Xa Makefile to translate and compile them.
  1436. X
  1437. XTo install p2c for public use, edit the Makefile to indicate the correct
  1438. Xdirectory names.  Suggested names are included as comments.  Also change
  1439. XMANFILE as shown to store the man page in the proper form for the "man"
  1440. Xcommand.
  1441. X
  1442. X    HOMEDIR      default /usr/lib/p2c       Home directory
  1443. X    INCDIR       default /usr/include/p2c   Include directory
  1444. X    BINDIR       default /usr/bin           Directory for "p2c" executable
  1445. X    LIBDIR       default /usr/lib           Directory for "libp2c.a" library
  1446. X    MANDIR       default /usr/man/man1      Directory for "p2c.1" manual page
  1447. X
  1448. XMake sure the home and include directories have been created and are
  1449. Xwritable, and that the bin, lib, and man directories are writable.
  1450. X(You may have to be root to do this.)  Recompile "p2c" with another
  1451. X"make install".  Be sure "trans.c" is recompiled with the new value
  1452. Xof HOMEDIR; you can ensure this by doing "make newhome" before
  1453. X"make install".  You can always type "make" with no arguments to
  1454. Xcompile without installing.
  1455. X
  1456. XHP Pascal Workstation System users will want to copy all of ../HP/include
  1457. Xinto the new p2c include directory, and copy all of ../HP/import into
  1458. Xthe p2c home directory.  You will have to write emulations for the
  1459. Xfunctions you use out of these modules.  (The HP directories are
  1460. Xpresent in the ftp distribution only---they have been omitted from
  1461. Xthe shar'd version to save space.)
  1462. X
  1463. XIncomplete interface texts for standard Turbo units are included in
  1464. Xturbo.imp.  Turbo users will have to flesh these out and write emulations
  1465. Xfor whatever parts of the Turbo runtime library they need.
  1466. X
  1467. XIf you wish to edit various system-wide configuration parameters, it is
  1468. Xbetter to put them in loc.p2crc than in sys.p2crc.  As an example, on a
  1469. XTurbo-oriented environment you may wish to add
  1470. X
  1471. X    Language Turbo
  1472. X
  1473. Xto the loc.p2crc file to replace the normal default (HP Pascal).
  1474. X
  1475. X
  1476. X
  1477. XPORTABILITY
  1478. X
  1479. XP2c was originally developed on a homebrew C compiler on the HP Pascal
  1480. XWorkstation operating system.  Current development takes place on HP-UX,
  1481. Xwhich is System V based.  The translator has also been compiled and used
  1482. Xon Sun-3's, so presumably it is fairly portable among 32-bit Unix machines.
  1483. X
  1484. XMany parts of the code will have to be adjusted in order for p2c to work
  1485. Xon a machine with 16-bit ints.  I have never had reason or opportunity to
  1486. Xtrack these down since I don't have access to such a machine.  Please note
  1487. Xthat code _generated_ by p2c works with either size of int even though p2c
  1488. Xitself does not.
  1489. X
  1490. XIf your compiler supports ANSI prototypes, most of the 16-bit portability
  1491. Xproblems will go away except for possible %d/%ld sloppiness in sprintf control
  1492. Xstrings.  There may be places where p2c tries to cast a pointer into an
  1493. Xint, but I believe all such cases use longs consistently.  You will have
  1494. Xa problem if your long type is not large enough to store a pointer.
  1495. X
  1496. XBecause p2c was developed to run under Unix, it is sloppy about memory
  1497. Xallocation.  Some data structures are allocated but never freed.  Profiles
  1498. Xshow that the waste is not too great in most cases, but if it is a problem
  1499. Xyou may have to write a garbage collector (this shouldn't be too hard if you
  1500. Xonly run the collector after translating each procedure).
  1501. X
  1502. END_OF_FILE
  1503. if test 5638 -ne `wc -c <'README'`; then
  1504.     echo shar: \"'README'\" unpacked with wrong size!
  1505. fi
  1506. # end of 'README'
  1507. fi
  1508. if test -f 'examples/Makefile' -a "${1}" != "-c" ; then 
  1509.   echo shar: Will not clobber existing file \"'examples/Makefile'\"
  1510. else
  1511. echo shar: Extracting \"'examples/Makefile'\" \(777 characters\)
  1512. sed "s/^X//" >'examples/Makefile' <<'END_OF_FILE'
  1513. X
  1514. X# Examples for "p2c", the Pascal to C translator.
  1515. X
  1516. X
  1517. X# The following definitions assume p2c has been compiled into the "home"
  1518. X# directory as shown in src/Makefile.
  1519. XP2C = ../p2c
  1520. XINC = ../home
  1521. XLIB = ../home/libp2c.a
  1522. X
  1523. X
  1524. Xdefault: comp
  1525. X
  1526. X
  1527. X# Translating everything:
  1528. X
  1529. Xtrans:  fact.c  e.c  self.c  cref.c  basic.c
  1530. X
  1531. Xfact.c: fact.p
  1532. X    $(P2C) fact.p
  1533. X
  1534. Xe.c: e.p
  1535. X    $(P2C) e.p
  1536. X
  1537. Xself.c: self.p
  1538. X    $(P2C) self.p
  1539. X
  1540. Xcref.c: cref.p
  1541. X    $(P2C) cref.p
  1542. X
  1543. Xbasic.c: basic.p
  1544. X    $(P2C) basic.p
  1545. X
  1546. X
  1547. X
  1548. X# Compiling everything:
  1549. X
  1550. Xcomp:  fact  e  self  cref  basic
  1551. X
  1552. Xfact: fact.c
  1553. X    $(CC) -I$(INC) fact.c $(LIB) -o fact
  1554. X
  1555. Xe: e.c
  1556. X    $(CC) -I$(INC) e.c $(LIB) -o e
  1557. X
  1558. Xself: self.c
  1559. X    $(CC) -I$(INC) self.c $(LIB) -o self
  1560. X
  1561. Xcref: cref.c
  1562. X    $(CC) -I$(INC) cref.c $(LIB) -o cref
  1563. X
  1564. Xbasic: basic.c
  1565. X    $(CC) -I$(INC) basic.c $(LIB) -lm -o basic
  1566. X
  1567. X
  1568. X
  1569. X
  1570. X
  1571. X
  1572. END_OF_FILE
  1573. if test 777 -ne `wc -c <'examples/Makefile'`; then
  1574.     echo shar: \"'examples/Makefile'\" unpacked with wrong size!
  1575. fi
  1576. # end of 'examples/Makefile'
  1577. fi
  1578. if test -f 'examples/README' -a "${1}" != "-c" ; then 
  1579.   echo shar: Will not clobber existing file \"'examples/README'\"
  1580. else
  1581. echo shar: Extracting \"'examples/README'\" \(1432 characters\)
  1582. sed "s/^X//" >'examples/README' <<'END_OF_FILE'
  1583. X
  1584. XThis directory contains examples for "p2c", a Pascal to C translator.
  1585. X
  1586. X"p2c"  Copyright 1989  Dave Gillespie
  1587. X                       256-80 Caltech
  1588. X                       Pasadena CA 91125
  1589. X                       daveg@csvax.caltech.edu, cit-vax!daveg
  1590. X
  1591. X
  1592. X
  1593. X
  1594. XHere are some sample programs you can run through p2c.  The Makefile
  1595. Xfor this directory knows how to translate and compile all programs.
  1596. XThe "c" subdirectory contains pre-translated files you can compare
  1597. Xwith your p2c output.  (The "c" subdirectory is present in the ftp
  1598. Xdistribution only, not in the shar distribution.)
  1599. X
  1600. XTo translate only:          make trans   or just   make
  1601. XTo translate and compile:   make comp
  1602. X
  1603. XThese programs have been culled from various places around the Caltech
  1604. XC.S. educational lab.  All programs are by Dave Gillespie except as
  1605. Xnoted, and are in the HP Pascal dialect.
  1606. X
  1607. X
  1608. Xfact.p       The obligatory recursive factorial program.  Try this
  1609. X        one first: "make fact.c" to translate, or "make fact"
  1610. X        to translate and compile.
  1611. X
  1612. X
  1613. Xe.p           Program for computing "e" to high precision.
  1614. X        (Courtesy of Scott Hemphill.)
  1615. X
  1616. X
  1617. Xself.p       A self-printing program in Pascal.  Try translating,
  1618. X        running, and diff'ing the output with self.p.
  1619. X
  1620. X
  1621. Xcref.p       A cross-referencer for Pascal programs.  Enter source
  1622. X        file name(s), then a blank line, then output file name.
  1623. X
  1624. X
  1625. Xbasic.p       An interpreter for the Basic language, just for kicks!
  1626. X        See "basic.doc" for documentation.
  1627. X
  1628. END_OF_FILE
  1629. if test 1432 -ne `wc -c <'examples/README'`; then
  1630.     echo shar: \"'examples/README'\" unpacked with wrong size!
  1631. fi
  1632. # end of 'examples/README'
  1633. fi
  1634. if test -f 'examples/e.p' -a "${1}" != "-c" ; then 
  1635.   echo shar: Will not clobber existing file \"'examples/e.p'\"
  1636. else
  1637. echo shar: Extracting \"'examples/e.p'\" \(2411 characters\)
  1638. sed "s/^X//" >'examples/e.p' <<'END_OF_FILE'
  1639. X
  1640. X$partial_eval on$
  1641. X
  1642. Xprogram e(input,output);
  1643. X
  1644. Xconst
  1645. X   NDIGITS = 1007;
  1646. X   NPRINT = 1000;
  1647. X
  1648. Xtype
  1649. X   digit = 0..255;
  1650. X   digitarray = packed array [0..NDIGITS] of digit;
  1651. X
  1652. Xvar
  1653. X   s,x,t: ^digitarray;
  1654. X   xs,ts: integer;
  1655. X   i: integer;
  1656. X
  1657. Xprocedure initinteger(var x:digitarray; n:integer);
  1658. Xvar
  1659. X   i: integer;
  1660. Xbegin
  1661. X   x[0] := n;
  1662. X   for i := 1 to NDIGITS do x[i] := 0;
  1663. Xend;
  1664. X
  1665. Xprocedure divide(var x:digitarray; xs,n:integer;
  1666. X                 var y:digitarray; var ys:integer);
  1667. Xvar
  1668. X   i: integer;
  1669. X   c: integer;
  1670. Xbegin
  1671. X   c := 0;
  1672. X   for i := xs to NDIGITS do begin
  1673. X      c := 10*c + x[i];
  1674. X      y[i] := c div n;
  1675. X      c := c mod n;
  1676. X   end;
  1677. X   ys := xs;
  1678. X   while (ys <= NDIGITS) and (y[ys] = 0) do ys := ys+1;
  1679. Xend;
  1680. X
  1681. Xprocedure add(var s,x:digitarray; xs:integer);
  1682. Xvar
  1683. X   i: integer;
  1684. X   c: integer;
  1685. Xbegin
  1686. X   c := 0;
  1687. X   for i := NDIGITS downto xs do begin
  1688. X      c := s[i] + x[i] + c;
  1689. X      if c >= 10 then begin
  1690. X         s[i] := c - 10;
  1691. X         c := 1;
  1692. X      end else begin
  1693. X         s[i] := c;
  1694. X         c := 0;
  1695. X      end;
  1696. X   end;
  1697. X   i := xs;
  1698. X   while c <> 0 do begin
  1699. X      i := i-1;
  1700. X      c := s[i] + c;
  1701. X      if c >= 10 then begin
  1702. X         s[i] := c - 10;
  1703. X         c := 1;
  1704. X      end else begin
  1705. X         s[i] := c;
  1706. X         c := 0;
  1707. X      end;
  1708. X   end;
  1709. Xend;
  1710. X
  1711. Xprocedure sub(var s,x:digitarray; xs:integer);
  1712. Xvar
  1713. X   i: integer;
  1714. X   c: integer;
  1715. Xbegin
  1716. X   c := 0;
  1717. X   for i := NDIGITS downto xs do begin
  1718. X      c := s[i] - x[i] + c;
  1719. X      if c < 0 then begin
  1720. X         s[i] := c + 10;
  1721. X         c := -1;
  1722. X      end else begin
  1723. X         s[i] := c;
  1724. X         c := 0;
  1725. X      end;
  1726. X   end;
  1727. X   i := xs;
  1728. X   while c <> 0 do begin
  1729. X      i := i-1;
  1730. X      c := s[i] + c;
  1731. X      if c < 0 then begin
  1732. X         s[i] := c + 10;
  1733. X         c := -1;
  1734. X      end else begin
  1735. X         s[i] := c;
  1736. X         c := 0;
  1737. X      end;
  1738. X   end;
  1739. Xend;
  1740. X
  1741. Xbegin
  1742. X   new(s); new(x);
  1743. X   initinteger(s^,0);
  1744. X   initinteger(x^,1);
  1745. X   xs := 0;
  1746. X   add(s^,x^,xs);
  1747. X   i := 0;
  1748. X   repeat
  1749. X      i := i+1;
  1750. X      divide(x^,xs,i,x^,xs);
  1751. X      add(s^,x^,xs);
  1752. X      write(#M'Series: ',100*xs/(NDIGITS+1):5:2,'%');
  1753. X   until xs > NDIGITS;
  1754. X   writeln;
  1755. X   writeln('':45,'e = ',s^[0]:1,'.');
  1756. X   i := 0;
  1757. X   for i := 1 to NPRINT do begin
  1758. X      write(s^[i]:1);
  1759. X      if i mod 1000 = 0 then writeln;
  1760. X      if i mod 100 = 0 then writeln
  1761. X      else if i mod 10 = 0 then write(' ');
  1762. X   end;
  1763. X   writeln;
  1764. X   write('Final digits: ');
  1765. X   for i := NPRINT+1 to NDIGITS do begin
  1766. X      write(s^[i]:1);
  1767. X   end;
  1768. X   writeln;
  1769. Xend.
  1770. END_OF_FILE
  1771. if test 2411 -ne `wc -c <'examples/e.p'`; then
  1772.     echo shar: \"'examples/e.p'\" unpacked with wrong size!
  1773. fi
  1774. # end of 'examples/e.p'
  1775. fi
  1776. if test -f 'examples/fact.p' -a "${1}" != "-c" ; then 
  1777.   echo shar: Will not clobber existing file \"'examples/fact.p'\"
  1778. else
  1779. echo shar: Extracting \"'examples/fact.p'\" \(299 characters\)
  1780. sed "s/^X//" >'examples/fact.p' <<'END_OF_FILE'
  1781. X
  1782. X
  1783. Xprogram factorials(input, output);
  1784. X
  1785. X
  1786. Xvar
  1787. X   i : integer;
  1788. X
  1789. X
  1790. X
  1791. Xfunction fact(n : integer) : integer;
  1792. X   begin
  1793. X      if n > 1 then
  1794. X         fact := n * fact(n-1)
  1795. X      else
  1796. X         fact := 1;
  1797. X   end;
  1798. X
  1799. X
  1800. X
  1801. Xbegin
  1802. X   for i := 1 to 10 do
  1803. X      writeln('The factorial of ', i:1, ' is ', fact(i):1);
  1804. Xend.
  1805. X
  1806. X
  1807. X
  1808. END_OF_FILE
  1809. if test 299 -ne `wc -c <'examples/fact.p'`; then
  1810.     echo shar: \"'examples/fact.p'\" unpacked with wrong size!
  1811. fi
  1812. # end of 'examples/fact.p'
  1813. fi
  1814. if test -f 'examples/p2crc' -a "${1}" != "-c" ; then 
  1815.   echo shar: Will not clobber existing file \"'examples/p2crc'\"
  1816. else
  1817. echo shar: Extracting \"'examples/p2crc'\" \(822 characters\)
  1818. sed "s/^X//" >'examples/p2crc' <<'END_OF_FILE'
  1819. X
  1820. X# Configuration options for translating the p2c examples.
  1821. X
  1822. X
  1823. XLanguage    HP    # All programs are in HP Pascal dialect
  1824. X
  1825. XVarFiles    0    # This helps basic.text's listtokens procedure work
  1826. X
  1827. XUseEnum        0    # Not necessary except to keep Sun's pitpicking
  1828. X            # compiler happy.
  1829. X
  1830. X
  1831. X# These kludges will get basic.c to compile without extra runtime support:
  1832. X# External procedures:
  1833. XFuncMacro    hpm_new(p,n) = (*p = Malloc(n))
  1834. XFuncMacro    hpm_dispose(p,n) = Free(*p)
  1835. XFuncMacro    misc_getioerrmsg(s,io) = sprintf(s, "I/O Error %d", (int)io)
  1836. XFuncMacro    misc_printerror(er,io) = printf("Error %d/%d!\n", (int)er, (int)io)
  1837. XFuncMacro    gotoxy(a,b) = 0
  1838. X# Functions imported from asm:
  1839. XFuncMacro    asm_iand(a,b) = (a & b)
  1840. XFuncMacro    asm_ior(a,b) = (a | b)
  1841. X# Functions in basic.text; may as well do these, too:
  1842. XFuncMacro    ixor(a,b) = (a ^ b)
  1843. XFuncMacro    inot(a) = (~a)
  1844. X
  1845. X
  1846. END_OF_FILE
  1847. if test 822 -ne `wc -c <'examples/p2crc'`; then
  1848.     echo shar: \"'examples/p2crc'\" unpacked with wrong size!
  1849. fi
  1850. # end of 'examples/p2crc'
  1851. fi
  1852. if test -f 'examples/self.p' -a "${1}" != "-c" ; then 
  1853.   echo shar: Will not clobber existing file \"'examples/self.p'\"
  1854. else
  1855. echo shar: Extracting \"'examples/self.p'\" \(1101 characters\)
  1856. sed "s/^X//" >'examples/self.p' <<'END_OF_FILE'
  1857. Xprogram self(input, output);
  1858. Xtype s = string[255]; n=integer;
  1859. Xvar a : array [1..100] of s; i,j : integer;
  1860. Xfunction t(a:integer):integer; begin if a<7 then t:=a else t:=a+11 end; function q(a:s):s;
  1861. X var j:n;begin for j:=strlen(a)downto 1 do if a[j]=#39 then strinsert(#39,a,j);q:=a;end;
  1862. Xbegin
  1863. X   a[1] := 'program self(input, output);';
  1864. X   a[2] := 'type s = string[255]; n=integer;';
  1865. X   a[3] := 'var a : array [1..100] of s; i,j : integer;';
  1866. X   a[4] := 'function t(a:integer):integer; begin if a<7 then t:=a else t:=a+11 end; function q(a:s):s;';
  1867. X   a[5] := ' var j:n;begin for j:=strlen(a)downto 1 do if a[j]=#39 then strinsert(#39,a,j);q:=a;end;';
  1868. X   a[6] := 'begin';
  1869. X   a[18] := '   for i := 1 to 11 do begin setstrlen(a[i+6], 0);';
  1870. X   a[19] := '      strwrite(a[i+6],1,j,''   a['',t(i):1,''] := '''''', q(a[t(i)]), '''''';'');';
  1871. X   a[20] := '   end;';
  1872. X   a[21] := '   for i := 1 to 22 do writeln(a[i]);';
  1873. X   a[22] := 'end.';
  1874. X   for i := 1 to 11 do begin setstrlen(a[i+6], 0);
  1875. X      strwrite(a[i+6],1,j,'   a[',t(i):1,'] := ''', q(a[t(i)]), ''';');
  1876. X   end;
  1877. X   for i := 1 to 22 do writeln(a[i]);
  1878. Xend.
  1879. END_OF_FILE
  1880. if test 1101 -ne `wc -c <'examples/self.p'`; then
  1881.     echo shar: \"'examples/self.p'\" unpacked with wrong size!
  1882. fi
  1883. # end of 'examples/self.p'
  1884. fi
  1885. if test -f 'src/loc.p2clib.c' -a "${1}" != "-c" ; then 
  1886.   echo shar: Will not clobber existing file \"'src/loc.p2clib.c'\"
  1887. else
  1888. echo shar: Extracting \"'src/loc.p2clib.c'\" \(185 characters\)
  1889. sed "s/^X//" >'src/loc.p2clib.c' <<'END_OF_FILE'
  1890. X
  1891. X/* Put p2c runtime features local to your system here.
  1892. X * In particular, additional initialization may be provided by defining
  1893. X * the symbol LOCAL_INIT when you compile p2clib.c.
  1894. X */
  1895. X
  1896. END_OF_FILE
  1897. if test 185 -ne `wc -c <'src/loc.p2clib.c'`; then
  1898.     echo shar: \"'src/loc.p2clib.c'\" unpacked with wrong size!
  1899. fi
  1900. # end of 'src/loc.p2clib.c'
  1901. fi
  1902. if test -f 'src/loc.p2crc' -a "${1}" != "-c" ; then 
  1903.   echo shar: Will not clobber existing file \"'src/loc.p2crc'\"
  1904. else
  1905. echo shar: Extracting \"'src/loc.p2crc'\" \(138 characters\)
  1906. sed "s/^X//" >'src/loc.p2crc' <<'END_OF_FILE'
  1907. X
  1908. X# Store public p2crc commands local to your system here, so that
  1909. X# you can grab a new version of sys.p2crc without losing your changes.
  1910. X
  1911. END_OF_FILE
  1912. if test 138 -ne `wc -c <'src/loc.p2crc'`; then
  1913.     echo shar: \"'src/loc.p2crc'\" unpacked with wrong size!
  1914. fi
  1915. # end of 'src/loc.p2crc'
  1916. fi
  1917. if test -f 'src/string.pas' -a "${1}" != "-c" ; then 
  1918.   echo shar: Will not clobber existing file \"'src/string.pas'\"
  1919. else
  1920. echo shar: Extracting \"'src/string.pas'\" \(1802 characters\)
  1921. sed "s/^X//" >'src/string.pas' <<'END_OF_FILE'
  1922. X
  1923. X{ Oregon Software Pascal dynamic string package. }
  1924. X
  1925. X
  1926. X{*VarFiles=0}  {INTF-ONLY}
  1927. X
  1928. Xfunction Len(var s : array [lo..hi:integer] of char) : integer; external;
  1929. X{FuncMacro Len(lo,hi,s) = strlen(s)}
  1930. X
  1931. Xprocedure Clear(var s : array [lo..hi:integer] of char); external;
  1932. X{FuncMacro Clear(lo,hi,s) = (s[lo] = 0)}
  1933. X
  1934. Xprocedure ReadString(var f : text;
  1935. X             var s : array [lo..hi:integer] of char); external;
  1936. X{FuncMacro ReadString(f,lo,hi,s) = fgets(s, hi-lo+1, f)}
  1937. X
  1938. Xprocedure WriteString(var f : text;
  1939. X              var s : array [lo..hi:integer] of char); external;
  1940. X{FuncMacro WriteString(f,lo,hi,s) = fprintf(f, "%s", s)}
  1941. X
  1942. Xprocedure Concatenate(var d : array [lod..hid:integer] of char;
  1943. X              var s : array [los..his:integer] of char); external;
  1944. X{FuncMacro Concatenate(lod,hid,d,los,his,s) = strcat(d, s)}
  1945. X
  1946. Xfunction Search(var s : array [lo..hi:integer] of char;
  1947. X        var s2 : array [lo2..hi2:integer] of char;
  1948. X        i : integer) : integer; external;
  1949. X{FuncMacro Search(lo,hi,s,lo2,hi2,s2,i) = strpos2(s,s2,i-lo)+lo}
  1950. X
  1951. Xprocedure Insert(var d : array [lod..hid:integer] of char;
  1952. X         var s : array [los..his:integer] of char;
  1953. X         i : integer); external;
  1954. X{FuncMacro Insert(lod,hid,d,los,his,s,i) = strinsert(s,d,i-lod)}
  1955. X
  1956. Xprocedure Assign(var d : array [lo..hi:integer] of char;
  1957. X         var s : array [los..his:integer] of char); external;
  1958. X{FuncMacro Assign(lo,hi,d,los,his,s) = strcpy(d,s)}
  1959. X
  1960. Xprocedure AssChar(var d : array [lo..hi:integer] of char;
  1961. X          c : char); external;
  1962. X{FuncMacro AssChar(lo,hi,d,c) = sprintf(d, "%c", c)}
  1963. X
  1964. Xfunction Equal(var s1 : array [lo1..hi1:integer] of char;
  1965. X           var s2 : array [lo2..hi2:integer] of char) : boolean; external;
  1966. X{FuncMacro Equal(lo1,hi1,s1,lo2,hi2,s2) = !strcmp(s1,s2)}
  1967. X
  1968. Xprocedure DelString(var s; i, j : integer); external;
  1969. X
  1970. Xprocedure SubString(var d; var s; i, j : integer); external;
  1971. X
  1972. END_OF_FILE
  1973. if test 1802 -ne `wc -c <'src/string.pas'`; then
  1974.     echo shar: \"'src/string.pas'\" unpacked with wrong size!
  1975. fi
  1976. # end of 'src/string.pas'
  1977. fi
  1978. if test -f 'src/system.m2' -a "${1}" != "-c" ; then 
  1979.   echo shar: Will not clobber existing file \"'src/system.m2'\"
  1980. else
  1981. echo shar: Extracting \"'src/system.m2'\" \(803 characters\)
  1982. sed "s/^X//" >'src/system.m2' <<'END_OF_FILE'
  1983. X
  1984. X(* Declarations for Modula-2 built-in objects *)
  1985. X
  1986. X(* Note: All functions with unusual syntaxes are not included here *)
  1987. X
  1988. X
  1989. X
  1990. XDEFINITION MODULE SYSTEM;   (*PERMANENT*)
  1991. X
  1992. XTYPE
  1993. X   PROC = PROCEDURE;
  1994. X   ADDRESS = POINTER TO WORD;
  1995. X
  1996. XFUNCTION  CAP(c : CHAR) : CHAR;
  1997. XFUNCTION  CHR(i : INTEGER) : CHAR;
  1998. XFUNCTION  ODD(i : INTEGER) : BOOLEAN;
  1999. XFUNCTION  ROUND(x : REAL) : INTEGER;
  2000. XFUNCTION  TRUNC(x : REAL) : INTEGER;
  2001. X(* Other things are defined internally to p2c *)
  2002. X
  2003. XEND;
  2004. X
  2005. X
  2006. X
  2007. XDEFINITION MODULE InOut;
  2008. X
  2009. X
  2010. X
  2011. XEND;
  2012. X
  2013. X
  2014. X
  2015. XDEFINITION MODULE MathLib0;
  2016. X
  2017. XFUNCTION  arctan(x : REAL) : REAL;
  2018. XFUNCTION  cos(x : REAL) : REAL;
  2019. XFUNCTION  entier(x : REAL) : INTEGER;
  2020. XFUNCTION  exp(x : REAL) : REAL;
  2021. XFUNCTION  ln(x : REAL) : REAL;
  2022. XFUNCTION  real(i : INTEGER) : REAL;
  2023. XFUNCTION  sin(x : REAL) : REAL;
  2024. XFUNCTION  sqrt(x : REAL) : REAL;
  2025. X
  2026. XEND.
  2027. X
  2028. X
  2029. END_OF_FILE
  2030. if test 803 -ne `wc -c <'src/system.m2'`; then
  2031.     echo shar: \"'src/system.m2'\" unpacked with wrong size!
  2032. fi
  2033. # end of 'src/system.m2'
  2034. fi
  2035. echo shar: End of archive 1 \(of 32\).
  2036. cp /dev/null ark1isdone
  2037. MISSING=""
  2038. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 ; do
  2039.     if test ! -f ark${I}isdone ; then
  2040.     MISSING="${MISSING} ${I}"
  2041.     fi
  2042. done
  2043. if test "${MISSING}" = "" ; then
  2044.     echo You have unpacked all 32 archives.
  2045.     echo "Now see PACKNOTES and the README"
  2046.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2047. else
  2048.     echo You still need to unpack the following archives:
  2049.     echo "        " ${MISSING}
  2050. fi
  2051. ##  End of shell archive.
  2052. exit 0
  2053.